home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 9 / The PC-SIG Library on CD ROM - Ninth Edition.iso / 301_400 / DISK0324 / DISK0324.ZIP / PTOOLTIM.PAS < prev    next >
Pascal/Delphi Source File  |  1985-02-21  |  3KB  |  73 lines

  1. Program PTOOLTIM;  {Copyright  R D Ostrander
  2.                                Ostrander Data Services
  3.                                5437 Honey Manor Dr
  4.                                Indianapolis  IN  46241
  5.  
  6.      This is a demonstration program for the Turbo Pascal subroutine PTOOLTIM
  7.      for time manipulations. Address any questions to the author at the above
  8.      address.                                                                }
  9.  
  10. {$V-}     { This parameter is necessary in order to pass String parameters
  11.             of other than 11 characters.                                     }
  12.  
  13. Var
  14.    CurrTime, YourTime : String [11];
  15.    Ch                 : Char;
  16.  
  17.  
  18. {$I PTOOLTIM.INC}  {Include statement for PTOOLTIM functions and parameters }
  19.  
  20.  
  21. BEGIN
  22.  
  23.  ClrScr;
  24.  Gotoxy (15,5); Write ('Demonstration of PTOOLTIM procedure.');
  25.  Gotoxy (15,7); Write ('PTOOLTIM and this program are copyrights');
  26.  Gotoxy (15,8); Write ('of R D Ostrander');
  27.  Gotoxy (15,9); Write ('   Ostrander Data Services');
  28.  Gotoxy (15,10); Write ('   5437 Honey Manor Dr');
  29.  Gotoxy (15,11); Write ('   Indianapolis  IN  46241');
  30.  Gotoxy (15,13); Write ('and have been placed in the public domain.');
  31.  Delay (4000);
  32.  ClrScr;
  33.  
  34.  YourTime := ' ';
  35.  While YourTime = ' ' do
  36.        Begin
  37.             Gotoxy (1, 5); Write ('What time is it?              ');
  38.             Gotoxy (18,5); Read (YourTime);
  39.             Gotoxy (31, 5);
  40.             If PTTValid (YourTime) then
  41.                ClrEol
  42.             else
  43.                 Begin
  44.                      Write (YourTime, ' invalid - try again');
  45.                      YourTime := ' ';
  46.                 End;
  47.       End;
  48.  CurrTime := PTTHCurr;
  49.  Gotoxy (1, 7); Write ('The current time is : ', CurrTime);
  50.  PTOOLTIM_HH_Disp := 24;
  51.  Gotoxy (17,8); Write ('Aka : ', PTTHtoH (CurrTime),
  52.                        '     in 24 hour format');
  53.  PTOOLTIM_HH_Disp := 12;
  54.  PTOOLTIM_D_Type := 'D';
  55.  Gotoxy (23,9); Write (PTTHtoD (CurrTime):12:6, ' in Decimal Days');
  56.  PTOOLTIM_D_Type := 'H';
  57.  Gotoxy (23,10); Write (PTTHtoD (CurrTime):12:6, ' in Decimal Hours');
  58.  PTOOLTIM_D_Type := 'M';
  59.  Gotoxy (23,11); Write (PTTHtoD (CurrTime):12:6, ' in Decimal Minutes');
  60.  PTOOLTIM_D_Type := 'S';
  61.  Gotoxy (23,12); Write (PTTHtoD (CurrTime):5:0, '        in Decimal Seconds');
  62.  PTOOLTIM_D_Type := 'M';
  63.  Gotoxy (1, 14); Write ('In 95 minutes it will be : ',
  64.                         PTTADD (CurrTime, 95.0));
  65.  Gotoxy (1, 16); Write ('You said ', YourTime,
  66.                         '    ( ', PTTHtoH (YourTime), ' )');
  67.  PTOOLTIM_D_Type := 'S';
  68.  Gotoxy (1, 18); Write ('You were off by ',
  69.                         Abs (PTTComp (YourTime, CurrTime)):5:0, ' Seconds');
  70.  
  71. Gotoxy (1, 24);
  72.  
  73. END.